<?php 
require_once 'mysql.php';
//1.获取数据
$username = $_POST['username'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];
$num = $_POST['num'];
//2.连接数据库
if ($username!='' && $password!='') {
	$sql = "INSERT INTO user(username,password,repassword,num) 
	VALUES('$username','$password','$repassword','$num')";
	$result = mysqli_query($conn,$sql);//执行$sql语句
	if($result){
		// echo($username.':'.$password.':'.$repassword.':'.$number);
		header('location:login.php');
	}else{
		echo('注册失败！'.mysqli_error($conn));
		header('location:register.html');
		// echo($username.':'.$password.':'.$repassword.':'.$number);
	}
}else{
	echo('注册失败: 用户名或密码不能为空！');
}


?>